<template>
  <div class="g-wrap"  v-if="program">
    <div class="u-cover-rank">
      <img v-lazy="program.coverUrl" alt="">
    </div>
    <div class="m-info">
      <div class="hd">
        <i class="hd-icon-song-list"></i>
        <h2>{{program.name}}</h2>
      </div>
      <div class="rdiname" v-if="program.radio">
        <i class="u-icon"></i>
        <a href="#" :title="program.radio.name" class="con">{{program.radio.name}}</a>
        <span class="j-flag">
          <a href="#" class="u-btn">
            <i>
              <em class="u-icon2"></em>订阅({{program.radio.subCount}})
            </i>
          </a>
        </span>
      </div>

<!--      <p class="album-desc-dot"  >-->
<!--        <b>介绍：</b>-->
<!--        <span ></span>-->
<!--      </p>-->
<!--        <p class="desc-more" >-->
<!--          <b>介绍：</b>-->
<!--          <span></span>-->
<!--        </p>-->
<!--      <div class="f-cb">-->
<!--        <a href="javascript:;" class="zhankai" v-if="isShow" @click="changeShow('up')">展开</a>-->
<!--        <a href="javascript:;" class="zhankai" v-else @click="changeShow('down')">收起</a>-->
<!--        <i :class="u_icn"></i>-->
<!--      </div>-->
    </div>
    <div class="m-prointr">
      <div class="btns">
        <a href="javascript:;" class="ply" style="margin-right: 10px">
          <i class="ply">
            <em class="ply"></em>
            播放 {{time(program.duration)}}
          </i>
        </a>

        <a href="javascript:;">

          <i class="ply" style="padding: 0 7px 0 10px;">
            <em></em>({{program.likedCount}})</i>
        </a>
        <a href="javascript:;">
          <i class="ply">({{program.commentCount}})</i>
        </a>
        <a href="javascript:;">
          <i class="ply">下载</i>
        </a>
        <a href="javascript:;">
          <i class="ply">({{program.shareCount}})</i>
        </a>
        <div class="out-list">
          <i class="u-icn"></i>
          <a href="#">生成外链播放器</a>
        </div>
      </div>
    </div>
    <div class="sub">
      <router-link :to="{name:'DjRadioView',query:{id:program.categoryId}}" class="cat">{{program.categoryName}}</router-link>
      <strong>
        <span class="f-vam" :title="program.radio.name" v-if="program.radio">
          {{program.radio.name}}
        </span>
        第{{program.serialNum}}期
      </strong>
      <span class="sep">{{formatDate(program.createTime)}} 创建</span>
      <span class="sep">
        播放：
        <em class="play-count">{{program.listenerCount}}</em>
        次
      </span>
    </div>
    <p class="simple-description" v-if="program.description">
      介绍： <span v-html="program.description.replace(/\n/g,'<br>')"></span>
    </p>
    <p class="full-description"></p>

  </div>
</template>

<script>
import {formatDate} from '@/utils/formatDate'
import {voiceDuration} from "@/utils/voiceDuration";

export default {
  name: "index",
  props:['program'],
  data(){
    return {
      formatDate:formatDate,
      voiceDuration:voiceDuration,
      isShow:true,
      u_icn:'u-icn-down'
    }
  },
  methods:{
    time(str){
      let time =  voiceDuration(str)
      if (time){
        let arr =  time.split(':')
        arr.splice(1,0,'分')
        arr.push('秒')

        return arr.join('')
      }
    },
    changeShow(str){
      this.isShow = !this.isShow
      if (str==='up'){
        this.u_icn = 'u-icn-up'
      }else {
        this.u_icn = 'u-icn-down'
      }
    }
  },
  mounted() {
  }
}
</script>

<style scoped lang="less">
.g-wrap {
  width: 640px;
  margin: 0 auto;
  padding-top: 40px;


  .u-cover-rank {
    width: 140px;
    height: 140px;
    padding: 3px;
    border: 1px solid #d5d5d5;
    float: left;
    position: relative;

    img {
      width: 140px;
      height: 140px;
    }

    span {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 208px;
      height: 208px;
      background: url("../../../assets/coverall.png") no-repeat -230px -380px;
    }
  }

  .m-info {
    width: 470px;
    height: auto;
    overflow: hidden;
    margin-top: 20px;
    margin-left: 170px;

    .hd {
      margin-bottom: 30px;
      position: relative;
      line-height: 36px;

      .hd-icon-song-list {
        display: inline-block;
        margin-right: 10px;
        width: 73px;
        height: 30px;
        float: left;
        overflow: hidden;
        vertical-align: middle;
        background: url("../../../assets/icon2.png") no-repeat 0 -70px;
      }

      h2 {
        font-size: 20px;
        font-weight: 400;

        margin-left: 80px;
        margin-top: -5px;
      }
    }
    .rdiname{
      line-height: 26px;
      .u-icon{
        float: left;
        margin: 5px 7px 0 0;
        width: 16px;
        height: 17px;
        background-position: -50px -20px;
        display: inline-block;
        overflow: hidden;
        vertical-align: middle;
        background-image: url("../../../assets/icon2.png");
      }
      .con{
        font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
        font-size: 16px;
        color: #666;
        float: left;
        max-width: 65%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .j-flag{
        .u-btn, .u-btn i {
          height: 28px;
          overflow: hidden;
          line-height: 29px;
          color: #333;
          float: left;
          height: 31px;
          line-height: 30px;
          min-width: 23px;
          cursor: pointer;
        }
        .u-btn{
          margin-left: 17px;
          padding: 0 5px 0 0;
          white-space: nowrap;
          background-image: url("../../../assets/button2.png");
          background-position: right -2400px;
          i{
            padding: 0 10px;
            background-position: 0 -2370px;
            background-image: url("../../../assets/button2.png");
            .u-icon2{
              float: left;
              margin: 7px 4px 0 0;
              width: 14px;
              height: 14px;
              background-position: -50px 0;
              display: inline-block;
              overflow: hidden;
              vertical-align: middle;
              background-image: url("../../../assets/icon2.png");
            }
          }
        }

      }
    }
.desc-more{
  margin-top: 10px;
  line-height: 18px;
  b{
    font-weight: normal;
    color: #666;
  }
}
    .album-desc-dot {
      display: inline-block;
      margin-top: 10px;
      line-height: 18px;
      font-size: 12px;
      color: #666;
      width: 410px;
      //height: 180px;
      b{
        font-weight: normal;
        color: #666;
      }
    }
    .f-cb{
      width: 400px;
      text-align: right;
      .zhankai{
        color: #0c73c2;
      }
      .u-icn-down{
        display: inline-block;
        width: 11px;
        height: 8px;
        background: url("../../../assets/icon.png") no-repeat -65px -520px;
      }
      .u-icn-up{
        display: inline-block;
        width: 11px;
        height: 8px;
        background: url("../../../assets/icon.png") no-repeat -45px -520px;
      }
    }
  }
  .m-prointr{
    margin-top: 65px;
    .btns {
      width: 483px;
      height: 31px;
      margin-bottom: 25px;

      .ply {
        background-repeat: no-repeat;
        background-image: url("../../../assets/button2.png");
      }
      .out-list {
        width: 140px;
        height: 16px;
        float: left;
        display: flex;
        align-items: center;
        margin: -25px 0 0 450px;

        .u-icn {
          width: 16px;
          height: 16px;
          display: inline-block;
          background-image: url("../../../assets/icon.png");
          background-position: -34px -863px;
        }

        a {
          color: #4996d1;
          text-decoration: underline;
        }
      }

      a {
        display: inline-block;
        float: left;
        margin-right: 5px;

        i {
          margin-right: 5px;
          color: #666;
        }

        &:nth-child(1) {

          background-position: right -676px;

          i {
            padding: 0 10px 0 8px;
            display: inline-block;
            *display: inline;
            *zoom: 1;
            height: 31px;
            line-height: 31px;
            overflow: hidden;
            *line-height: 32px;
            vertical-align: top;
            text-align: center;
            cursor: pointer;
            color: #fff;
            background-position: 0 -387px;

            em {
              float: left;
              width: 20px;
              height: 18px;
              margin: 6px 2px 2px 0;
              background-position: 0 -1622px;
            }
          }
        }


        &:nth-child(2) {
          em{
            width: 17px;
            height: 15px;
            float: left;
            margin: 8px 6px 0 0;
            background-image: url("../../../assets/button2.png");
            background-position: 0 -95px;
          }
          i {
            background-position: 0 -59px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 7px 0 28px;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
            border-right: 1px solid #C3C3C3;
          }
        }

        &:nth-child(3) {
          i {
            background-position: 0 -1465px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 7px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }

        &:nth-child(4) {
          i {
            background-position: 0 -1225px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 10px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }

        &:nth-child(5) {
          i {
            background-position: 0 -2761px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 10px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }
      }
    }
  }
}
.sub{
  height: 35px;
  line-height: 35px;
  .cat{
    margin: -3px 9px 0 0;
    position: relative;
    color: #cc0000;
    display: inline-block;
    position: relative;
    top: -1px;
    height: 16px;
    overflow: hidden;
    padding: 0 6px;
    border: 1px solid #cc0000;
    line-height: 16px;
    *line-height: 18px;
    vertical-align: middle;
    font-size: 12px;
    &:hover{
      background-color: #FBEEEE;
    }
  }
  strong{
    font-size: 14px;
    font-weight: bold;
    .f-vam{
      padding-bottom: 2px;
      max-width: 42%;
      margin-right: 5px;
      vertical-align: middle;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      word-wrap: normal;
    }
  }
  .sep{
    margin-left: 18px;
    color: #999;
    .play-count{
      color: #c20c0c;
    }
  }

 }
.simple-description{
  line-height: 23px;
  color: #666;
}
.full-description{

}
</style>